<?php $this->load->view("header");?>
<div class="row-bids">
	<div class="container no-padding wrap_unregister_job">
		<div class="row">
			<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
				<div class="col-lg-8 col-md-8 col-sm-8 col-xs-8 no-padding">
					<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 title_name_job no-padding">
						<?php echo $projects->project_name;?>
					</div>
					<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 no-padding">
						<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-size no-padding">
							Budgets : <?php echo "$".$projects->budget_min." - $".$projects->budget_max;?>
						</div>
						<div class="col-lg-2 col-md-3 col-sm-2 col-xs-3 text-size no-padding">
							Applicants : <?php echo getTotalFreelancerBids($projects->id);?>
						</div>
						<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-size no-padding">
							Status : <?php echo getProjectStatus($projects->project_status);?>
						</div>
						<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3"></div>
					</div>
				</div>
				<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 no-padding">
					<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 btn-job-like text-center no-padding">
						<a onclick="window.location='<?php echo site_url('buyer/signUp/'.$projects->id.'');?>'" class="btn btn-lg btn_post_same_pr">POST A JOB LIKE THIS</a>
					</div>
					<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 text-center">
						<span><a href="<?php echo site_url('buyer/signUp');?>" class="sign-up-apply">Sign up to Apply</a></span>
					</div>
				</div>
			</div>
			<!-- <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
				<div class="col-lg-4 col-lg-offset-4 col-md-4 col-md-offset-4 col-sm-4 col-md-offset-4 divide-page"></div>
			</div> -->

			<div class="col-md-12 distance_top">
				<div class="col-md-8" style="background-color:#F9F9F9;min-height:195px;">
					<div class="divide f16-m">
                        <div class="pr_title pr_name f24-m" style="font-weight:bold;">Job Description</div>
                        <div id="desc_project" class="text-justify">
                        	<?php 
                        		if(strlen($projects->description) > 200) 
            						echo cutStringDes($projects->description,220)."...<a class='see_more' data-content= '".addslashes($projects->description)."' >More</a>";
            					else
            						echo addslashes($projects->description);
                        	?>
                        </div>
                    </div>
                    <div class="divide f14-m distance_top">
                    	<div class="col-lg-3 col-md-3 no-padding">
                    		<div class="pr_title f24-m">Skill required</div>
                    	</div>
                    	<div class="col-md-9">
                    		<ul>
                    			<li class="float_skill">
                    				 <?php
		                                $array_project_categories = explode(",",$projects->project_categories);
		                                    foreach($list_skills->result() as $item){
		                                        if(in_array($item->id,$array_project_categories)){
		                                            ?>
		                                            <li data-id='<?php echo $item->id?>' class="link_category">
		                                            	<a class="btn btn-md" style="margin-bottom:3px;" href="<?php echo site_url('project/category/'.$item->id);?>"><?php echo $item->category_name?></a>
		                                            </li>
		                                        <?php }
		                                    }
		                                
		                                ?>
                    			</li>
                    		</ul>
                    	</div>
                    </div>
				</div>

				<div class="col-md-4" style="background-color:#FFFDF4">
					<div class="about_employer text-center f24-m" style="margin-top:20px">
						About the Employer
					</div>
					<?php 
						if(isset($creatorInfo)){
					?>
					<div class="rating-freelancer no-padding text-center">
                        <input id="input-21e2" value="<?php echo $creatorInfo->user_rating;?>" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" disabled="disabled">
                    </div> <!-- rating-freelancer -->
                    <div class="col-lg-12 text-center f18-m">
                        <div class="col-lg-12 text-center" style="padding-top:0px"><span>Total spent</span> $<?php echo getFrozenBalance($creatorInfo->id);?></div>
                        <div class="col-lg-12 text-center"><?php echo $creatorInfo->num_reviews;?> reviews</div>
                        <div class="col-lg-12 text-center"><?php echo getTotalProjectClientDone($creatorInfo->id);?> open jobs</div>
                        <div class="col-lg-12 text-center">Payment Method Not Verified ?</div>
                    </div>
					<?php
						}
					?>
					
				</div>
			</div>

			<div class="col-md-12 same_projects">Similar Projects</div>
			<?php
				// echo "<pre>";
				// print_r($same_projects->result());
				// echo "</pre>";
			?>
				<div class="main-content col-md-12">
				<?php
					if(isset($same_projects)){
						$dem = 0;
						foreach ($same_projects->result() as $item) {
							$dem++;
							$logo = getLogoGroup($item->group_id);
				?>
					<div class="col-md-3 col-xs-12 col-sm-12 no-padding item-content <?php if ($dem % 4 == 0) echo "item-content-last"; ?>">
						<div class="img-item-app">
							<div class="border col-md-5 col-xs-5 col-sm-5">
	                        </div>
	                        <a href="<?php echo site_url('project/view/' . $item->pid) ?>" title="<?php echo $item->project_name?>" class="">
	                            <img src="<?php
	                            			$filename = 'files/project_attachment/'.$item->logo; 
	                            			if(!empty($item->logo) && file_exists($filename)) 
	                            				echo base_url().'/files/project_attachment/'.$item->logo;
	                            			 else 
	                            			 	echo base_url().'/files/project_attachment/avt_project_default.png';
	                            		?>"
	                                 class="img-responsive">
	                        </a>
						</div>

						<div class="info-item-app col-sm-12 col-md-12 col-xs-12 bg-info-item-app">
							<div class="title-item-app col-lg-8 col-xs-12 col-sm-8 no-padding">
								<div>
									<a title="<?php echo $item->project_name?>" href="<?php echo site_url('project/view/' . $item->pid)?>"><?php echo $item->project_name ?></a>
								</div>
	                            <div>bởi <?php echo $item->user_name; ?></div>
							</div>
							<div class="price-item-app col-lg-4 col-sm-4 col-xs-12 no-padding">
	                            $<?php if ($item->budget_max != "") echo $item->budget_max; else echo "N/A" ?>
	                        </div>
	                        <div class="read-more col-xs-12 <?php echo $logo['hover'];?>">
	                            <a title="<?php echo $item->project_name?>" href="<?php echo site_url('project/view/' . $item->pid) ?>">Read more
	                                <img class="img-responsive"
	                                     src="<?php echo base_url() ?>app/css/images/arrow-read-more.png">
	                            </a>
	                        </div>
						</div>
					</div>
				<?php
						}
					}else{
						echo "Không có dự án tương tự.";
					}
				?>
					
					<?php //($dem / 4 == 1) ? $dem = 0 : $dem = $dem;?>
				</div>
		</div><!-- end row -->
	</div>
</div>

<script type="text/javascript">
	$(document).ready(function(){
		$(".float_skill").children().addClass("btn btn-sm btn-primary");
	    $('body').on('click','a.see_more',function(){
	    	var content_description = $(this).attr('data-content');
	    	$('#desc_project').html(content_description);
	    })
	})
</script>
<?php $this->load->view("footer");?>